import axios from 'axios'
import config from '@/config'

const apiService = axios.create({
	baseURL: config.API_URL,
	timeout: config.timeout
})

// request拦截器
apiService.interceptors.request.use(config => {
	// if (true) {
	// 	config.headers['X-Token'] = getToken
	// }
	return config
}, error => {
	console.log(error)
	Promise.reject(error)
})

// response拦截器
apiService.interceptors.response.use(response => response,
	error => {
		console.log(error)
		return Promise.reject(error)
	}
)

export default apiService
